package cn.cheln.support.data.text.xml;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import java.util.HashMap;
import java.util.Map;

public class SPUtil
{
  static Map<String, SharedPreferences> preferences = new HashMap();

  public static void clear(String paramString)
  {
    if (!(preferences.containsKey(paramString)))
      return;
    SharedPreferences localSharedPreferences = (SharedPreferences)preferences.remove(paramString);
    localSharedPreferences.edit().clear();
    localSharedPreferences.edit().commit();
  }

  public static Object getValue(Context paramContext, String paramString1, String paramString2, Class paramClass)
  {
    Boolean localBoolean;
    SharedPreferences localSharedPreferences = onOpen(paramContext, paramString1);
    if (paramClass == Boolean.class)
      localBoolean = Boolean.valueOf(localSharedPreferences.getBoolean(paramString2, false));
    do
    {
      return localBoolean;
      if (paramClass == Integer.class)
        return Integer.valueOf(localSharedPreferences.getInt(paramString2, -1));
      if (paramClass == String.class)
        return localSharedPreferences.getString(paramString2, null);
      if (paramClass == Float.class)
        return Float.valueOf(localSharedPreferences.getFloat(paramString2, -1.0F));
      localBoolean = null;
    }
    while (paramClass != Long.class);
    return Long.valueOf(localSharedPreferences.getLong(paramString2, -1L));
  }

  public static SharedPreferences onOpen(Context paramContext, String paramString)
  {
    if (!(preferences.containsKey(paramString)))
      preferences.put(paramString, paramContext.getSharedPreferences(paramString, 0));
    return ((SharedPreferences)preferences.get(paramString));
  }

  public static void putValue(Context paramContext, String paramString1, String paramString2, Object paramObject)
  {
    SharedPreferences.Editor localEditor = onOpen(paramContext, paramString1).edit();
    if (paramObject == null)
      localEditor.putString(paramString2, null);
    while (true)
    {
      localEditor.commit();
      return;
      if (paramObject instanceof Boolean)
        localEditor.putBoolean(paramString2, ((Boolean)paramObject).booleanValue());
      if (paramObject instanceof Integer)
        localEditor.putInt(paramString2, ((Integer)paramObject).intValue());
      if (paramObject instanceof String)
        localEditor.putString(paramString2, (String)paramObject);
      if (paramObject instanceof Float)
        localEditor.putFloat(paramString2, ((Float)paramObject).floatValue());
      if (!(paramObject instanceof Long))
        continue;
      localEditor.putLong(paramString2, ((Long)paramObject).longValue());
    }
  }
}

/* Location:           H:\360云盘\lewa_explorer_3.0\bin\FileApp_orig_dex2jar.jar
 * Qualified Name:     cn.cheln.support.data.text.xml.SPUtil
 * JD-Core Version:    0.5.2
 */